﻿Namespace DoFactory.GangOfFour.Adapter.Structural
    ''' <summary>
    ''' MainApp startup class for Structural
    ''' Adapter Design Pattern.
    ''' </summary>
    Public Class MainApp
        ''' <summary>
        ''' Entry point into console application.
        ''' </summary>
        Public Shared Sub Main()
            ' Create adapter and place a request
            Dim target As Target = New Adapter()
            target.Request()
        End Sub

    End Class

    ''' <summary>
    ''' The 'Target' class
    ''' </summary>
    Class Target
        Public Overridable Sub Request()
            Console.WriteLine("Called Target Request()")
        End Sub
    End Class

    ''' <summary>
    ''' The 'Adapter' class
    ''' </summary>
    Class Adapter
        Inherits Target

        Private _adaptee As New Adaptee()
        Public Overrides Sub Request()
            ' Possibly do some other work
            '  and then call SpecificRequest
            _adaptee.SpecificRequest()
        End Sub

    End Class

    ''' <summary>
    ''' The 'Adaptee' class
    ''' </summary>
    Class Adaptee

        Public Sub SpecificRequest()
            Console.WriteLine("Called SpecificRequest()")
        End Sub

    End Class

End Namespace
